<html lang="zh-cn">
<head>
{% include "tdm_include_head_template.html" %}
<link href="/static/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
</head>

<body class=" theme-blue">
{% include "tdm_include_navbar_template.html" %}

<div class="container">
  <br/>
  {% include "tdm_include_error_template.html" %}

  <div class="row main">
    <div class="col-lg-3 col-sm-12">
      <h1 style="padding:0;margin:0">{{user_obj.name}}</h1>
    </div>
    <div class="col-lg-9 col-sm-12" id="report_main">
      <form class="form-horizontal" action="/tdm/profile/" method="post">
        <div class="form-group">
          <label for="inputEmail3" class="col-sm-2 control-label">电子邮件</label>
          <div class="col-sm-10">
            <input type="email" name="email" class="form-control" id="inputEmail3" value="{{user_obj.email}}">
          </div>
        </div>
        <div class="form-group">
          <label for="inputPhone" class="col-sm-2 control-label">电话</label>
          <div class="col-sm-10">
            <input type="text" name="phone" class="form-control" id="inputPhone" value="{{user_obj.phone}}">
          </div>
        </div>
        <div class="form-group">
          <label for="inputPassword" class="col-sm-2 control-label">密码</label>
          <div class="col-sm-10">
            <input type="password" name="password" class="form-control" id="inputPassword">
          </div>
        </div>
        <div class="form-group">
          <label for="inputPassword1" class="col-sm-2 control-label">确认密码</label>
          <div class="col-sm-10">
            <input type="password" name="password1" class="form-control" id="inputPassword1">
          </div>
        </div>
        <div class="form-group">
          <div class="col-sm-offset-2 col-sm-10">
            <button id="op" name="op" type="submit" value="user_profile" class="btn btn-primary">修改</button>
          </div>
        </div>
      </form>
    </div>
  </div>

  {% include "tdm_include_footer_template.html" %}
</div>

<script type="text/javascript">
$(function() {
  sidebar_nav_clone();
  $("#op").click(function(){
    if ($("input[name=password]").val()!=$("input[name=password1]").val()) {
      alert("密码不一致，请重新输入");
      return false;
    }
    if ($("input[name=password]").val()=="") {
      alert("密码不能为空");
      return false;
    }
    if ($("input[name=email]").val()=="") {
      alert("邮件不能为空");
      return false;
    }
    if ($("input[name=phone]").val()=="") {
      alert("电话不能为空");
      return false;
    }
    if (mobile_number_check($("input[name=phone]").val())==false) {
      alert("电话号码格式错误");
      return false;
    }
    return true;
  });
});
</script>
</body>
</html>
